<?php
namespace app\index\controller;

use app\BaseController;
use think\facade\Request;

class Index extends BaseController
{
    public function index($name = '你好，ThinkPHP API！')
    {
        $template = app()->getRootPath() . 'public/pc/index.html';
        if (Request::isMobile()) {
            $template = app()->getRootPath() . 'public/mobile/index.html';
        }
        if (file_exists($template)) {
            return view($template);
        }
        return json($name);
    }
}
